package com.raymond.queue.client.codec.encodeing;

import com.alibaba.fastjson.JSONObject;
import com.raymond.queue.common.codec.annotation.MsgCodec;
import com.raymond.queue.common.codec.encodeing.BaseEncoder;
import com.raymond.queue.common.enums.CommandIdType;
import com.raymond.queue.common.msg.BaseAgreement;
import com.raymond.queue.common.msg.BaseMessage;
import com.raymond.queue.common.msg.MsgHead;
import com.raymond.queue.common.msg.request.CreateTopicRequest;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;

/**
 * 创建topic请求编码
 * @author :  raymond
 * @version :  V1.0
 * @date :  2021-07-14 14:32
 */
@MsgCodec(commandId = CommandIdType.CREATE_TOPIC_REQ)
public class CreateTopicRequestEncoder extends BaseEncoder {

    @Override
    public byte[] encode0(BaseMessage msg) throws Exception {
        return JSONObject.toJSONString(msg).getBytes();
    }
}
